#ifndef DNS_H
#define DNS_H

#include "dns_base.h"
#include "hash_table.h"
#include "storage.h"

struct packet_type;

extern unsigned char DnsNameTable[256];
extern unsigned char InvalidDnsNameTable[256];

#define TOLOWER(_ch)  DnsNameTable[((unsigned char)_ch)]

int to_lowercase(unsigned char * buf, int n);

int check_dns_name(unsigned char * domain, packet_type *lowerdomain);

int cpy_dns_name(packet_type *dstdomain, packet_type *srcdomain);
mvalue_t* find_addr(packet_type *lowerdomain, unsigned char *ip, unsigned int ip_len, int* num);

mvalue_t* get_record_from_name_type(unsigned char *qname, int qtype);

#endif